package com.guava.collection;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

/**
 * BimapTester--GuavaTest
 * 双向Map,值到键，键到值
 *
 * @author: Jovi
 * @createTime: 2018-05-08 15:48
 **/
public class BimapTester {

    public static void main(String[] args) {

        BiMap<Integer, String> empIdNameMap = HashBiMap.create();

        empIdNameMap.put(new Integer(101), "Mahesh");
        empIdNameMap.put(new Integer(102), "Sohan");
        empIdNameMap.put(new Integer(103), "Ramesh");

        System.out.println(empIdNameMap.inverse().get("Mahesh"));//bimap的值映射到其相关联的键的逆视图。

    }

}
